
import { DefaultLayout, GraphNode } from "@/js/components/GraphNode"
import { GraphView } from "@/js/components/GraphView"
import { InputLinkNodeNumber, InputLinkNodeString } from "@/js/components/InputLinkNode"

export class Var extends GraphNode{
    layout?: DefaultLayout
    load(){
        super.load()

        const layout = new this.DefaultLayout(this, this.graphView as GraphView, false, false)
        this.layout = layout
        this.appendChild(layout.container)

        const stringEntry = new InputLinkNodeString(this, this.graphView as GraphView, {
            name: "varName",
            desc: '变量名称',
            placeholder:"变量名称",
            model: "entry",
            showLinkNode: false
        })
        layout.main?.left.appendChild(stringEntry)

        // 默认值
        const defauleEntry = new InputLinkNodeNumber(this, this.graphView as GraphView, {
            name: "defaultValue",
            desc: '默认值',
            model: "entry",
            showLinkNode: false
        })
        layout.main?.left.appendChild(defauleEntry)

        layout.main?.right.appendChild(new InputLinkNodeNumber(this, this.graphView as GraphView, {
            name: "quote", 
            desc: '引用',
            model: "output",
            showInput: false,
        }))
    }
}